﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace DataToViz
{
    public partial class Confige : Form
    {
        public Confige()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 读取配置数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Confige_Load(object sender, EventArgs e)
        {
            textBox3.Text = Form1.runsleep.ToString();
            textBox4.Text = Form1.loadscenesleep.ToString();
            textBox6.Text = Form1.recivesleep.ToString();
            textBox1.Text = Form1.filepath.ToString();
            textBox2.Text = Form1.ghpath.ToString();
            textBox7.Text = Form1.scene.ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            XmlDocument confilefile = new XmlDocument();
            confilefile.Load(Application.StartupPath + "\\confige.xml");
            confilefile.SelectSingleNode("/root/runvizsleep").InnerText = textBox3.Text;
            confilefile.SelectSingleNode("/root/loadscene").InnerText = textBox4.Text;
            confilefile.SelectSingleNode("/root/recivesleep").InnerText = textBox6.Text;
            confilefile.SelectSingleNode("/root/vizpath").InnerText = textBox1.Text;
            confilefile.SelectSingleNode("/root/scenename").InnerText = textBox7.Text;
            confilefile.SelectSingleNode("/root/ghpath").InnerText = textBox2.Text;
            confilefile.Save(Application.StartupPath + "\\confige.xml");
        }
    }
}
